#include<bits/stdc++.h>
using namespace std;
int n,m;
string s[1000010];
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	freopen("indian.in","r",stdin);
	freopen("indian.out","w",stdout);
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		cin>>s[i];
		s[i]=" "+s[i];
		for(int j=1;j<=m;j++)
			if(s[i][j]=='#') cout<<"1";
			else cout<<".";
		cout<<"\n";
	}
	return 0;
}
